package com.tencreat.service.mall.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.tencreat.common.core.domain.model.ReqIdParam;
import com.tencreat.common.core.domain.model.ReqIdsParam;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.tencreat.mapper.mall.MallOrderKillMapper;
import com.tencreat.domain.mall.MallOrderKill;
import com.tencreat.service.mall.IMallOrderKillService;

/**
 * 参与秒杀用户Service业务层处理
 *
 * @author tencreat
 * @date 2021-09-09
 */
@Service
public class MallOrderKillServiceImpl extends ServiceImpl<MallOrderKillMapper, MallOrderKill> implements IMallOrderKillService {


    /**
     * 查询参与秒杀用户
     *
     * @param id 参与秒杀用户ID
     * @return 参与秒杀用户
     */
    @Override
    public MallOrderKill selectMallOrderKillById(ReqIdParam id) {
        return baseMapper.selectById(id.getId());
    }

    /**
     * 查询参与秒杀用户列表
     *
     * @param mallOrderKill 参与秒杀用户
     * @return 参与秒杀用户
     */
    @Override
    public List<MallOrderKill> selectMallOrderKillList(MallOrderKill mallOrderKill) {
        return baseMapper.selectList(Wrappers.query(mallOrderKill));
    }

    /**
     * 新增参与秒杀用户
     *
     * @param mallOrderKill 参与秒杀用户
     * @return 结果
     */
    @Override
    public int insertMallOrderKill(MallOrderKill mallOrderKill) {
        return baseMapper.insert(mallOrderKill);
    }

    /**
     * 修改参与秒杀用户
     *
     * @param mallOrderKill 参与秒杀用户
     * @return 结果
     */
    @Override
    public int updateMallOrderKill(MallOrderKill mallOrderKill) {
        return baseMapper.updateById(mallOrderKill);
    }

    /**
     * 批量删除参与秒杀用户
     *
     * @param ids 需要删除的参与秒杀用户ID
     * @return 结果
     */
    @Override
    public int deleteMallOrderKillByIds(ReqIdsParam ids) {
        return baseMapper.deleteBatchIds(ids.getId());
    }

    /**
     * 删除参与秒杀用户信息
     *
     * @param id 参与秒杀用户ID
     * @return 结果
     */
    @Override
    public int deleteMallOrderKillById(ReqIdParam id) {
        return baseMapper.deleteById(id.getId());
    }
}
